Wildcards

Wildcards are used to match string patterns. They are similar to regular expressions except regular expressions are much more powerful and the syntax is different.

Different styles of wildcard formats exist that are somewhat but not entirely compatible. Some examples are Unix and DOS (Windows). PFrank supports Unix style wildcards.

The special characters used for Unix style wildcard matching in this product are:

Pattern  Meaning 
* matches everything
? matches any single character
[ ] matches any character or range of characters specified between the brackets
[ ! ] matches any character not matching the characters or range of characters specified after the exclamation point

Initially, people can get confused between wildcards and regular expressions. As mentioned above, the symbols used for wildcards have somewhat different meanings when used for regular expressions. One difference is that * means "anything" in file name wildcards, whereas * means "zero or more of the preceding character" in regular expressions. Also, ? in file name wildcards is similar to . in regular expressions. In wildcards, the period just stands for itself.

Below are some examples.

*
* finds file names with zero or more occurrences of any character. This pattern can be used to match all filenames.
 
*.*
*.* finds file names with zero or more occurrences of any character, followed by a "." (i.e. dot), followed by zero or more occurrences of any character. This pattern can be used to find all filenames with a dot extension.
 
*.???
*.??? finds file names with zero or more occurrences of any character, followed by a "." (i.e. dot), followed by three occurrences of any character. This pattern can be used to find all filenames with three character dot extensions.
 
*.jpg
*.jpg finds file names with zero or more occurrences of any character, followed by a "." (i.e. dot), followed by the character string "jpg". This pattern can be used to find jpeg files
 
Q*
Q* finds file names beginning with a capital Q followed by zero or more occurrences of any other character.
 
Q[a-z]*
Q[a-z]* finds file names beginning with a capital Q followed by one lower case alphabetic character, followed by zero or more other characters of any kind.
 
Q[!a-z]*
Q[!a-z]* finds file names beginning with a capital Q followed by anything other than a lower case alphabetic character, followed by zero or more other characters of any kind.
 
Q[uU]*y
Q[uU]*y finds file names beginning with a capital Q, followed by one capital or lower case u, followed by zero or more of anything else, and ending with a lower case y.
 
file?
file? finds file names beginning with file followed by exactly one character. If instead, you specified file by itself, that would give you a file named file. Or if you specified file*, you'd find file names starting with file followed by 0 or more occurrences of other characters.